From 2f96a266fedb98f33a096b4b71fbcfc26b602448 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild2.aw" Date: Thu, 7 Dec 2006 14:49:00 -0700 Subject: [PATCH] [IA64] Map shared_info into guest pseudo physical address space Allows libxc to map from dom0. This is used by domain builder. Signed-off-by: Isaku Yamahata --- tools/libxc/xc_linux_build.c | 20 ++++++++++++-------- xen/arch/ia64/xen/dom0_ops.c | 22 +++++++++++----------- xen/include/asm-ia64/grant_table.h | 10 +++++++++- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c index 104a90d991..8ddb1ed525 100644 --- a/tools/libxc/xc_linux_build.c +++ b/tools/libxc/xc_linux_build.c @@ -481,9 +481,7 @@ static int setup_guest(int xc_handle, start_info_t *start_info; unsigned long start_info_mpa; struct xen_ia64_boot_param *bp; -#if 0 // see comment below shared_info_t *shared_info; -#endif int i; DECLARE_DOMCTL; int rc; @@ -595,13 +593,20 @@ static int setup_guest(int xc_handle, ctxt->user_regs.r28 = start_info_mpa + sizeof (start_info_t); munmap(start_info, PAGE_SIZE); -#if 0 /* - * XXX FIXME: - * The follwoing initialization is done by XEN_DOMCTL_arch_setup as - * work around. - * Should XENMEM_add_to_physmap with XENMAPSPACE_shared_info be used? + * shared_info is assiged into guest pseudo physical address space + * by XEN_DOMCTL_arch_setup. shared_info_frame is stale value until that. + * So passed shared_info_frame is stale. obtain the right value here. */ + domctl.cmd = XEN_DOMCTL_getdomaininfo; + domctl.domain = (domid_t)dom; + if ( (xc_domctl(xc_handle, &domctl) < 0) || + ((uint16_t)domctl.domain != dom) ) + { + PERROR("Could not get info on domain"); + goto error_out; + } + shared_info_frame = domctl.u.getdomaininfo.shared_info_frame; /* shared_info page starts its life empty. */ shared_info = xc_map_foreign_range( @@ -615,7 +620,6 @@ static int setup_guest(int xc_handle, shared_info->arch.start_info_pfn = nr_pages - 3; munmap(shared_info, PAGE_SIZE); -#endif free(page_array); return 0; diff --git a/xen/arch/ia64/xen/dom0_ops.c b/xen/arch/ia64/xen/dom0_ops.c index 18c2e2f88e..472f03dc54 100644 --- a/xen/arch/ia64/xen/dom0_ops.c +++ b/xen/arch/ia64/xen/dom0_ops.c @@ -125,19 +125,19 @@ long arch_do_domctl(xen_domctl_t *op, XEN_GUEST_HANDLE(xen_domctl_t) u_domctl) for_each_vcpu (d, v) v->arch.breakimm = d->arch.breakimm; } -#if 1 - /* - * XXX FIXME - * see comment around shared_info in setup_guest() in - * libxc/xc_linux_build.c - */ { - int i; - d->shared_info->arch.start_info_pfn = ds->maxmem >> PAGE_SHIFT; - for_each_cpu(i) - d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1; + /* + * XXX IA64_SHARED_INFO_PADDR + * assign these pages into guest psudo physical address + * space for dom0 to map this page by gmfn. + * this is necessary for domain build, save, restore and + * dump-core. + */ + unsigned long i; + for (i = 0; i < XSI_SIZE; i += PAGE_SIZE) + assign_domain_page(d, IA64_SHARED_INFO_PADDR + i, + virt_to_maddr(d->shared_info + i)); } -#endif } } diff --git a/xen/include/asm-ia64/grant_table.h b/xen/include/asm-ia64/grant_table.h index 1d0bded64f..895d1ee936 100644 --- a/xen/include/asm-ia64/grant_table.h +++ b/xen/include/asm-ia64/grant_table.h @@ -23,8 +23,16 @@ void guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long } while (0) +/* XXX + * somewhere appropriate + * those constand shouldn't be pre-defined and + * those area should be reserved by EFI MD. + */ +/* Guest phsyical address of shared_info */ +#define IA64_SHARED_INFO_PADDR (1UL << 40) + /* Guest physical address of the grant table. */ -#define IA64_GRANT_TABLE_PADDR (1UL << 40) +#define IA64_GRANT_TABLE_PADDR (IA64_SHARED_INFO_PADDR + XSI_SIZE) #define gnttab_shared_maddr(d, t, i) \ virt_to_maddr((char*)(t)->shared + ((i) << PAGE_SHIFT)) -- 2.30.2